package com.ruoyi.apiserver.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.ruoyi.apiserver.interceptor.JwtInterceptor;

/**
 * JWT配置类
 * 
 * @author ruoyi
 */
@Configuration
public class JwtConfig implements WebMvcConfigurer
{
    @Autowired
    private JwtInterceptor jwtInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
        // JWT拦截器
        registry.addInterceptor(jwtInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/api/login/**", "/api/register", "/api/captchaImage", "/swagger-ui.html", "/webjars/**", "/v2/**", "/swagger-resources/**", "/v3/api-docs/**", "/swagger-ui/**");

    }
}